<!--  这一段是直接用了uview的官方例子，然后自己改改 -->
<template>
	<view>

		<view class="u-menu-wrap">
			<!-- 左边菜单 可滚动视图区域 -->
			<!-- 			<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view">
				<! tap.stop阻止冒泡 -->
			<!-- 	<view v-for="(item,index) in tabbar" :key="index" class='u-tab-item'
					:class="[current == index ? 'u-tab-item-active' : '']" @click="current=index">
					<text class="u-line-1">{{item.name}}</text>
				</view>
			</scroll-view> -->
			<!-- 右边菜单 可滚动视图区域 -->
			<scroll-view scroll-y scroll-with-animation class="right-box">
				<view class="page-view">
					<view class="class-item" v-if="current==index" v-for="(item , index) in tabbar" :key="index">
						<!-- 						<view class="item-title">
							<text>{{item.text}}</text>
						</view> -->
						<view>
							<view class='menuDetailDiv' v-for="(item1, index1) in item.lists" :key="index1"
								@click="cartype(item1)">
								<image style="width: 120rpx; height: 80rpx;" :src="item1.carSeriesImg"></image>
								<view class="item-menu-name">{{item1.carSeriesName}}</view>
							</view>
						</view>
					</view>
				</view>
			</scroll-view>
		</view>
	</view>
</template>
<script>
	import {
		apigetByBrand
	} from '@/api/car.js'
	export default {
		data() {
			return {
				current: 0,
				tabbar: [],

			}
		},
		created() {
			this.getByBrand()
		},
		methods: {
			cartype(item) {

				this.$store.commit("setcartype", item)
				this.$emit("cartype")
			},
			getByBrand() {
				uni.showLoading({
					title: '加载中'
				})

				let id = this.$store.state.carseries
				apigetByBrand(id).then((res) => {

					uni.hideLoading()
					this.tabbar = [{
						name: '气动',
						text: 2023,
						lists: res.data
					}]
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.u-search-box {
		padding: 18rpx 30rpx;
	}

	.u-menu-wrap {
		flex: 1;
		display: flex;
		overflow: hidden;
	}

	.u-search-inner {
		background-color: rgb(234, 234, 234);
		border-radius: 100rpx;
		display: flex;
		align-items: center;
		padding: 10rpx 16rpx;
	}

	.u-search-text {
		font-size: 26rpx;
		color: $u-tips-color;
		margin-left: 10rpx;
	}

	.u-tab-view {
		width: 250rpx;
		height: 100%;
	}

	.u-tab-item {
		position: relative;
		height: 110rpx;
		background: #f6f6f6;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 26rpx;
		color: #444;
		font-weight: 400;
		line-height: 1;
	}

	// 选中以后改变样式
	.u-tab-item-active {
		position: relative;
		color: #000;
		font-size: 29rpx;
		font-weight: 600;
		background: #fff;
	}

	// 在前面加一个竖条
	.u-tab-item-active::before {
		content: "";
		position: absolute;
		// border-left: 4px solid $u-type-primary;
		border-left: 3px solid #009ff0;
		height: 32rpx;
		left: 0;
		top: 39rpx;
	}

	.u-tab-view {
		height: 100%;
	}

	.right-box {
		// background-color: rgb(250, 250, 250);
		background-color: #fff;
	}

	.page-view {
		// padding: 16rpx;
	}

	.class-item {
		margin-bottom: 10rpx;
		background-color: #fff;
		padding: 16rpx;
		border-radius: 8rpx;
	}

	.class-item:last-child {
		min-height: 100vh;
		// min-height: 500px;
	}

	.item-title {
		position: sticky;
		top: 0;
		font-size: 32rpx;
		padding: 5rpx 10rpx;
		font-size: 600;
		color: $u-main-color;
		background-color: #d4d4d4;
		z-index: 9990;

	}

	.item-menu-name {
		font-weight: normal;
		font-size: 26rpx;
		color: $u-main-color;
		line-height: 55rpx;
		margin-bottom: 20rpx;
	}

	.item-container {
		display: flex;
		flex-wrap: wrap;
	}

	.thumb-box {
		width: 33.333333%;
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		margin-top: 20rpx;
	}

	.item-menu-image {
		width: 120rpx;
		height: 120rpx;
	}

	.db_div {
		height: 80px;
		width: 100%;
		background-color: #fff;
		position: fixed;
		bottom: 0;
		/* 弹出层是10075 */
		z-index: 10075;
	}

	.db_div_show {
		height: 80px;
		width: 100%;
		background-color: #fff;
		position: fixed;
		bottom: 0;
	}

	.menuDetailDiv {
		display: flex;
		flex-direction: row;
		padding: 10rpx;
		margin: 10rpx 10rpx;
		height: 90rpx;
		font-size: 28rpx;
		border-bottom: #e6e6e6 solid 2rpx;
		/* justify-content: center;
        align-items: center; */
	}
</style>